package com.sun;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.io.File;
import java.io.IOException;

@SpringBootApplication
@MapperScan("com.sun.mapper")
@EnableTransactionManagement
public class SpringMVCMain {
    public static void main(String[] args) {
        String basePath = null;
        try {
            basePath = new File("./").getCanonicalPath();
            System.out.println("===============>>"+basePath);
        } catch (IOException e) {
            e.printStackTrace();
        }

        // 对于windows 需要修正一下目录名
        if (!basePath.startsWith("/")) {
            basePath = "/" + basePath;
        }
        System.setProperty("spring.app.home-path", basePath);
        System.out.println(basePath);
        String Path = basePath +File.separator+ "resources" + File.separator + "application.yml";
        System.out.println(Path);
        File file = new File(Path);
        if (file.exists()){
            System.out.println("有");
        }else {
            System.out.println("没有");
        }
        SpringApplication.run(SpringMVCMain.class,args);
    }
}
